-module(geocode_sup).

-behaviour(supervisor).

-export([start_link/2, init/1]).

start_link(Key, Filename) ->
  supervisor:start_link({local, ?MODULE}, ?MODULE, [Key, Filename]).

init([Key, Filename]) ->
  RestartStrategy    = one_for_one,
  MaxRestarts        = 1000,
  MaxTimeBetRestarts = 3600,

  SupFlags = {RestartStrategy, MaxRestarts, MaxTimeBetRestarts},

  ChildSpecs =
  [
   {geocode,
    {geocode, start_link, [Key, Filename]},
    permanent,
    1000,
    worker,
    [geocode]}
   ],
  {ok, {SupFlags, ChildSpecs}}.
